﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using CloudSoft.Extensions;

namespace ERPStore.Cart.Models
{
	public class AssignSource : ERPStore.Models.LeadSourceBase
	{
		public override string Id
		{
			get { return "B636151D-D13F-46B7-AE2E-7B5D91799CAC"; }
		}

		public override string Name
		{
			get { return "Panier assigné"; }
		}

		public override string Description
		{
			get { return "Panier assigné"; }
		}

		public override string TrackSourceId
		{
			get { return "assign"; }
		}

		public override string Medium
		{
			get { return "email"; }
		}

		public override ERPStore.Models.LeadSourceType LeadSourceType
		{
			get { return ERPStore.Models.LeadSourceType.Internal;  }
		}

		public override bool Match(Uri sourceUri, Uri landingUri, out string keywords, out string subHost, out decimal amount)
		{
			keywords = string.Empty; // sourceUri.GetSearchKeywords();
			subHost = null;
			amount = 0;
			var landingPrms = landingUri.GetParameters();
			if (landingPrms.AllKeys.Contains("estid"))
			{
				var estid = landingPrms["estid"];
				if (estid != null 
					&& estid.Equals("assign", StringComparison.InvariantCultureIgnoreCase))
				{
					subHost = "No referer";
					return true;
				}
			}

			return false;
		}

	}
}
